package sum.achilles.com.database;

import android.database.sqlite.SQLiteDatabase;

import java.util.Map;

import de.greenrobot.dao.AbstractDao;
import de.greenrobot.dao.AbstractDaoSession;
import de.greenrobot.dao.identityscope.IdentityScopeType;
import de.greenrobot.dao.internal.DaoConfig;

import sum.achilles.com.database.UserInfo;
import sum.achilles.com.database.NoteInfo;

import sum.achilles.com.database.UserInfoDao;
import sum.achilles.com.database.NoteInfoDao;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.

/**
 * {@inheritDoc}
 * 
 * @see de.greenrobot.dao.AbstractDaoSession
 */
public class DaoSession extends AbstractDaoSession {

    private final DaoConfig userInfoDaoConfig;
    private final DaoConfig noteInfoDaoConfig;

    private final UserInfoDao userInfoDao;
    private final NoteInfoDao noteInfoDao;

    public DaoSession(SQLiteDatabase db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
            daoConfigMap) {
        super(db);

        userInfoDaoConfig = daoConfigMap.get(UserInfoDao.class).clone();
        userInfoDaoConfig.initIdentityScope(type);

        noteInfoDaoConfig = daoConfigMap.get(NoteInfoDao.class).clone();
        noteInfoDaoConfig.initIdentityScope(type);

        userInfoDao = new UserInfoDao(userInfoDaoConfig, this);
        noteInfoDao = new NoteInfoDao(noteInfoDaoConfig, this);

        registerDao(UserInfo.class, userInfoDao);
        registerDao(NoteInfo.class, noteInfoDao);
    }

    public void clear() {
        userInfoDaoConfig.getIdentityScope().clear();
        noteInfoDaoConfig.getIdentityScope().clear();
    }

    public UserInfoDao getUserInfoDao() {
        return userInfoDao;
    }

    public NoteInfoDao getNoteInfoDao() {
        return noteInfoDao;
    }

}
